module Enumerable
	# Higher-order functions 1
	def group_by
		returnHash = {}
		each do |aObj|
			bKey = yield(aObj)
			returnHash[bKey] = [] unless returnHash[bKey]
			returnHash[bKey] << aObj
		end
		returnHash
	end
end

class Array
	def count
		t = 0
		each do |aObj|
			if yield(aObj) then
				t += 1
			end
		end
		return t
	end
end